<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui">
<h:head />
<h:body>
	<ui:composition>
		<p:dialog id="newcmptDlg" header="#{textResources['newCompetencyDialog.header']}" modal="true"
			widgetVar="newCompetencyDialog">
			<p:panelGrid id="newDialogLayout" cellpadding="4" columnClasses="top_align">
				<p:row>
					<p:column>
						<h:outputText value="Competency name:" class="dialog_label" />
					</p:column>
					<p:column>
						<h:inputText class="dialog_input" value="#{newCompetencyBean.competency.name}" />
						<h:inputHidden value="#{newCompetencyBean.parentCompetency.id}" />
						<h:inputHidden value="#{newCompetencyBean.competency.organizationID}" />
					</p:column>
				</p:row>

				<p:row>
					<p:column>
						<h:outputText value="Description:" class="dialog_label" />
					</p:column>
					<p:column>
						<h:inputTextarea class="dialog_input_area" value="#{newCompetencyBean.competency.description}" />
					</p:column>
				</p:row>

				<p:row>
					<p:column>
						<h:outputText value="Is group:" class="dialog_label" />
					</p:column>
					<p:column>
						<p:selectBooleanCheckbox value="#{newCompetencyBean.competency.isGroup}" />
					</p:column>
				</p:row>

				<p:row>
					<p:column>
						<h:outputText value="Parent competency:" class="dialog_label" />
					</p:column>
					<p:column>
						<p:autoComplete value="#{newCompetencyBean.parentCompetency}" maxResults="15" styleClass="dialog_input"
							completeMethod="#{autocompleteCompetencyBean.completeCompetencies}" var="c" itemLabel="#{c.name}"
							itemValue="#{c}" forceSelection="true" converter="#{competencyConverter}">
							<p:ajax event="itemSelect" listener="#{newCompetencyBean.handleSelectParent}" update="growl" />
						</p:autoComplete>
					</p:column>
				</p:row>

				<p:row>
					<p:column colspan="2">
						<p:commandButton styleClass="dialog_button" value="Save" oncomplete="newCompetencyDialog.hide()"
							actionListener="#{competenciesBean.createNewCompetency}" update="growl competencyTree" icon="ui-icon-check" />
						<p:commandButton styleClass="dialog_button" value="Cancel" oncomplete="newCompetencyDialog.hide()"
							icon="ui-icon-close" />
					</p:column>
				</p:row>
			</p:panelGrid>
		</p:dialog>
	</ui:composition>
</h:body>
</html>
